<?php
ob_start();
if(!isset($_SESSION)){
session_start();
}
if(!isset($_SESSION["userName"])){
	header("location: login.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>...:: eManazines ::...</title>
    <link rel="Stylesheet" href="css/style.css" type="text/css" />
    <link rel="Stylesheet" href="css/mystyle.css" type="text/css" />
    <!--
<script language="javascript">
 kiểm tra login 
function check(){
	if(document.flogin.news == 0){
		alert(" Lỗi, vui lòng chọn báo loại báo");
		return false;
	}else{
		return true;
	}
}
</script>
-->
<script type="text/javascript" charset="utf-8" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
	<script type="text/javascript" charset="utf-8" src="calendar/jcalendar.js"></script>
  <link rel="stylesheet" href="calendar/jcalendar.css" type="text/css" media="screen" charset="utf-8">

	<link rel="stylesheet" href="calender/style.css" type="text/css" media="screen" charset="utf-8">

  <script type="text/javascript" charset="utf-8">
    $(document).ready(function() {
      var l = window.location.href;
      var a = (l.indexOf("#") > -1) ? l.substr(l.indexOf("#")) : "#about";

      $("div.nav:not("+ a +")").hide();
      $("#nav a[@href="+ a +"]").addClass("active");
      $("div.nav>h2").hide();
      $("#nav a").click(function() {
        $($(this).attr("href")).fadeIn();
        $("div.nav:visible").hide();
        $("#nav a.active").removeClass("active");
        $(this).addClass("active");
      });

      $('fieldset.jcalendar').jcalendar();
    });
  </script></head>
<body>
    <div class="wrapper">
    <?php include ("top.php");?>
        <div class="body">
            <div class="login-left">
                <table cellpadding="7" cellspacing="0">
<tr>
                        <td colspan="2" class="text-3">
                             eManazines.com
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <img alt="" border="0" src="images/cam_39.gif" />
                        </td>
                        <td class="text-4">
                            <h3>Bước 1.</h3>
                      Chọn trang web(báo điện tử) muốn lấy tin từ hệ thống! Hiện tại chúng tôi đang sử dụng tin từ một số báo điện tử : vnexpress.net, dantri.com</td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <img alt="" border="0" src="images/cam_39.gif" />
                        </td>
                        <td class="text-4">
                            <h3>
                                Bước 2.</h3>
                            Chọn thời điểm nhận tin.! (Hệ thống cho phép chọn ngày gửi tin bất kì, tuy nhiên chỉ cho phép lấy tin trong ngày)</td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <img alt="" border="0" src="images/cam_39.gif" />
                        </td>
                        <td class="text-4">
                            <h3>Bước 3.</h3>
                          Chọn thể loại tin cần lấy.!</td>
                    </tr>
                    <tr>
                        <td colspan="2" class="login-left-bottom">&nbsp;</td>
                  </tr>
                </table>
          </div>
            <p>&nbsp;</p>
      <div class="login-right-wrapper">
                <h3>
                    Đăng kí nhận tin
                </h3>
                <div class="login-right">
                <form id="flogin" name="flogin" method="post" action="">
              <table width="300" cellpadding="5" cellspacing="0" style="line-height: 20px">
                        <tr>
                            <td>
                                <h4>
                                    Chọn loại báo muốn lấy tin</h4>
                                <label></label>                            </td>
                        </tr>
                        <tr>
                            <td> 
                                <h4>
                                  <label>
                                  <select name="news" id="news" style="width:300 px">
                                    <option value="0" selected="selected">Chọn loại báo có sẵn trong hệ thống để lấy tin</option>
                                    <option value="1">Vnexpress.net</option>
                                    <option value="2">Dân trí .com</option>
                                  </select>
                                  </label>
                                </h4>                                </td>
                        </tr>
                        <tr>
                          <td><h4>Chọn thể loại tin cần lấy</h4></td>
                        </tr>
                        <tr>
                          <td><label>
                            <select name="select" id="select">
                            </select>
                          </label></td>
                        </tr>
                        <tr>
                          <td>Thời điểm nhận tin: <br/>
                          <fieldset >
                          <legend>Select time</legend>
                          <select name="h" id="h">
                          <?php for($i = date("h"); $i <= 24; $i++){?>
                          	<option value="<?php echo $i;?>"><?php echo $i;?></option>
                           <?php }?>
                          </select> 
                          : 
                          <select name="i" id="i">
                          <?php for($i = date("i"); $i <= 60; $i ++){?>						 
                          	<option value="<?php echo $i;?>"><?php echo $i;?></option>
                          <?php }?>
                          </select> 
                          : 
                          <select name="s" id="s">
                          <?php for($i = date("s"); $i <= 60; $i ++){?>
                          	<option value="<?php echo $i;?>"><?php echo $i;?></option>
                          <?php }?>
                          </select>
                          (h - m - s)
                          </fieldset>
    <fieldset class="jcalendar">
      <legend>Select date</legend>
       <div class="jcalendar-wrapper">
       <div class="jcalendar-selects">
         <select name="day" id="day" class="jcalendar-select-day">
         	
         <?php for($i = date("d"); $i <= 31; $i ++){
           echo "<option value= $i >$i</option>";
         }?>
         </select>

         <select name="month" id="month" class="jcalendar-select-month">
        <?php 
		 $month_name = array("January","February","March","April","May","June","July","August","September","October","November","December");
		 $m = date("m");
		 
		 for($i = $m - 1; $i < 12; $i ++){
		 	$m_n = $month_name[$i];
			echo "<option value = $i +1>$m_n</option>";
		 }
		 
		 ?>            
         </select>
         <select name="year" id="year" class="jcalendar-select-year">
          <?php 
		  for($i = date("Y"); $i < 2030; $i ++){
		  	echo "<option value = $i >$i</option>";
		  }
		  ?>        
         </select>
       </div>
       </div>
    </fieldset>                          </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center">
                                <input name="next" type="submit" class="button" id="next" value="Tiếp tục" />                            </td>
                        </tr>
                  </table>
                  <?php
				  if(isset($_POST['next'])){
				  
				  $date = $_POST['year']."-".$_POST['month']."-".$_POST['day']." ".$_POST['h'].":".$_POST['i'].":".$_POST['s'];
				  session_register("date");
				  $_SESSION["date"] = $date;
				 // echo $time;
				  
				  $news = $_POST['news'];
				  	switch($news){
						case 0 : 
							echo "Vui lòng chọn báo.!";
							break;
						case 1 :
						//	echo $news;
							header("location:vnexpress.php");
							break;
						case 2 :
						//	echo $news;
							header("location:dantri/index.php");
							break;						
					}
					
				  }				  
				  ?>
                  </form>
                 
        </div>
            </div>
            <div class="vide">
            </div>
        </div>
        <?php include ("footer.php");?>
    </div>
</body>
</html>
<?php
ob_flush();
?>